package com.ee.chat.admin.controller.walletmanage;

import com.ee.chat.admin.service.ICreditService;
import com.ee.chat.common.bean.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("wallet/credit")
public class CreditController {
    private Logger log = LoggerFactory.getLogger(CreditController.class);

    @Resource
    ICreditService creditService;

    /**
     * 积分明细列表
     * @Author Shane
     * @Date 2019/10/25 21:08
     * @param
     * @return
     */
    @RequestMapping("list")
    public Result list(HttpServletRequest request, Integer userId, Integer proUserId, Integer type,
                       String createTime, @RequestParam Integer page, @RequestParam Integer limit){
        try {
            return creditService.list(request, userId, proUserId, type, createTime, page, limit);
        } catch (Exception e){
            log.error("【查询积分明细错误】", e);
        }
        return Result.returnFailure();
    }

    /**
     * 积分统计列表
     * @Author AppiJ
     * @Date 2020/8/13 19:15
     * @param
     * @return
     */
    @RequestMapping("statisticList")
    public Result statisticList(HttpServletRequest request, Integer userId, String field, String sort,
                                @RequestParam Integer page, @RequestParam Integer limit){
        try {
            return creditService.statisticList(request, userId, field, sort, page, limit);
        } catch (Exception e){
            log.error("【查询积分统计列表错误】", e);
        }
        return Result.returnFailure();
    }
}
